package chap6;
//********************************************************************
//  factorial.java              Author:GK
//
//  计算n的阶乘。
//********************************************************************
import java.util.Scanner;

public class factorial {

    public static void main(String[] args) {
        int n,c = 1;
        int b = 1;
        int d = 1;

        Scanner scan = new Scanner(System.in);
        System.out.print("请输入一个整数： ");
        n = scan.nextInt();

        for(int a = 1; a <= n; a++)
            b *= a;
        System.out.println("阶乘为： " + b);

        while( c <= n) {
            d *= c;
            c++;
        }
        System.out.println("阶乘为： " + d);
    }
}
